import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)

import './assets/global.scss'

// 阿里图标资源引入。请按照需要到https://www.iconfont.cn/新建项目选好图标然后把资源下载放进来
import "@/assets/aliIcon/menu/iconfont.css"

// unplugin-vue-components插件无法处理非组件模块，因此我们需要手动导入这些样式。scss导这个文件，css导入css.js
import "element-plus/es/components/message-box/style/index"   
import "element-plus/es/components/notification/style/index"   
import "element-plus/es/components/message/style/index"  
import "element-plus/es/components/loading/style/index"  

// 全局注册el-icon
// import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
//   app.component(key, component)
// }
// 按需引入el-icon
import { User,Lock,CopyDocument,DocumentAdd,Key,Fold,Expand,ArrowDown,Plus,Iphone} from '@element-plus/icons-vue'
const elIcons=[User,Lock,CopyDocument,DocumentAdd,Key,Fold,Expand,ArrowDown,Plus,Iphone]
elIcons.forEach(v=>{app.component(v.name,v)})

import "@/common/addWindowProperty"

import pinia from "@/store/install"
app.use(pinia)

import router from './router'
app.use(router)

import filters from "@/common/filters"
app.use(filters)

import globalProperties from './common/addGlobalProperty'
app.use(globalProperties)

import globalCustomComponentRegister from "@/common/globalCustomComponentRegister"
app.use(globalCustomComponentRegister) 
 
import i18n from  "@/locales"
app.use(i18n)

import vuePrint from "vue3-print-nb"
app.use(vuePrint)

if(import.meta.env.VITE_NODE_ENV != 'dev')
app.config.errorHandler=(err,errvc,errinfo)=>{
   console.log(err,errvc,errinfo)
}

app.mount('#app')
